<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="fa">

  </div>
  <script>
    function loadImage(src, resolve, reject) {
      let image = new Image()
      image.src = src
      image.onload = ()=>{
        resolve(image)
      }
      image.onerror = reject
    }
    loadImage('./source/img1.jpg',
    (image)=>{
      document.body.appendChild(image)
    },
    ()=>{
      var ele = document.createElement('div')
      // var con = document.createTextNode('kkkkkk')
      document.querySelector('#fa').appendChild(ele)
      // document.querySelector('div').innerText= '未能成功加载图片'
    })
  </script>
</body>
</html>